Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync bundle row state and bundle detail state #4246

Merged
merged 11 commits into from
Sep 9, 2022
Merged

Conversation

leilenah
Copy link
Collaborator

@leilenah leilenah commented Sep 7, 2022

Reasons for making this change

The state shown in the bundle row is currently not synced with the state shown in the expanded bundle details. This change ensures that the bundle row and the expanded bundle details will always be in sync.

Related issues

#4174

Screenshots

Before (prod)

20220907142603545.mp4

After (local)

20220907142709524.mp4

Checklist

  • I've added a screenshot of the changes, if this is a frontend change
  • I've added and/or updated tests, if this is a backend change
  • I've run the pre-commit.sh script
  • I've updated docs, if needed

Copy link
Collaborator

@percyliang percyliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the stateInfo terminology might be confusing, because state is a specific field within a bundle...

@percyliang
Copy link
Collaborator

Could you describe at a high-level what the fix was?

@leilenah
Copy link
Collaborator Author

leilenah commented Sep 8, 2022

@percyliang the worksheet view fetches basic bundle info on an interval in order to keep the rows up-to-date. The BundleDetail view also fetches basic bundle info on an interval (as well as more detailed information that the worksheet view doesn't need to fetch).

The issue is that the fetching isn't synced, so the fix I implemented is to allow the worksheet to dictate what state to display in the bundle detail view if necessary.

Note that I've updated some stateInfo variable names to make things more clear.

Copy link
Collaborator

@percyliang percyliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Would you mind updating the code with a comment that describes how the bundle information gets propagated from the table to the bundle detail page to keep things synchronized?

@leilenah
Copy link
Collaborator Author

leilenah commented Sep 9, 2022

@percyliang refactored a bit. lmk if this works

}
return [];
}

showTime(time) {
return time && time !== '<none>' && time !== '0s';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we should be able to access the raw value rather than the rendered one to avoid these rather brittle comparisons, so we could test whether time == null or something...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update the renderFormat helper to allow for this 👍

* This enables the bundle row and the bundle detail sidebar to show the
* exact same state information.
*/
const syncBundleStateInfo = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only is called once, so why not just inline?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like wrapping the logic in a named function makes it easier to figure out for someone else who might stumble across the code later.

Copy link
Collaborator

@percyliang percyliang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments, but overall looks good to me - thanks!

@mergify mergify bot merged commit 35ef624 into master Sep 9, 2022
@mergify mergify bot deleted the fix/4174-state-sync branch September 9, 2022 19:26
@epicfaace epicfaace mentioned this pull request Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State field doesn't refresh quickly in the table header view v/s bundle detail view.
2 participants